//https://leetcode.cn/problems/binary-tree-paths/

class Solution {
    vector<string> ret;
public:
    vector<string> binaryTreePaths(TreeNode* root)
    {
        if (root == nullptr) return ret;
        string path;
        dfs(root, path);
        return ret;

    }

    void dfs(TreeNode* root, string path)
    {
        path += to_string(root->val);
        if (root->left == nullptr && root->right == nullptr)
        {
            ret.push_back(path);
            return;
        }

        path += "->";

        if (root->left) dfs(root->left, path);
        if (root->right) dfs(root->right, path);


    }
};